﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.Prism.Modularity;
using Microsoft.Practices.ServiceLocation;
using Microsoft.Practices.Unity;
using Renci.iRods.Studio.Modules.Explorer.Views;
using Microsoft.Practices.Prism.Regions;
using Renci.iRods.Studio.Modules.Explorer.ViewModels;
using Renci.iRods.Studio.Common.Framework;
using Microsoft.Practices.Prism.Events;
using System.Threading;

namespace Renci.iRods.Studio.Modules.Explorer
{
    public class Explorer : IModule
    {
        #region IModule Members

        public void Initialize()
        {
            var container = ServiceLocator.Current.GetInstance<IUnityContainer>();
            container.RegisterInstance<object>("ExplorerDockableView", new ExplorerDockableView());
            container.RegisterInstance<object>("MetadataDockableView", new MetadataDockableView());
            container.RegisterInstance<object>("PropertiesDockableView", new PropertiesDockableView());
            container.RegisterInstance<object>("UsersDockableView", new UsersDockableView());

            var regionManager = ServiceLocator.Current.GetInstance<IRegionManager>();
            regionManager.RegisterViewWithRegion("RibbonRegion", () =>
            {
                var view = new ExplorerRibbonTabView();
                var model = new ExplorerRibbonTabViewModel();
                ViewModelBinder.Bind(model, view);
                return view;
            });
        }

        #endregion

    }
}
